package com.wangfugui.mybatisplus.service.impl;

import com.wangfugui.mybatisplus.dao.UserDao;
import com.wangfugui.mybatisplus.dao.WinningDao;
import com.wangfugui.mybatisplus.dao.domain.User;
import com.wangfugui.mybatisplus.dao.domain.Winning;
import com.wangfugui.mybatisplus.service.UserService;
import com.wangfugui.mybatisplus.service.WinningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author MaSiyi
 * @version 1.0.0 2021/12/11
 * @since JDK 1.8.0
 */
@Service
public class WinningServiceImpl implements WinningService {

    @Autowired
    private WinningDao winningDao;

    @Override
    @Transactional(propagation = Propagation.NESTED)
    public void winning2(Integer userId) {
        Winning winning = new Winning();
        winning.setUserId(userId);
        winningDao.insert(winning);
        throw new RuntimeException("fu*k Transactional2");
    }
}
